//
//  AboutMEViewController.m
//  CarCare
//
//  Created by ileo on 15/2/3.
//  Copyright (c) 2015年 baozun. All rights reserved.
//

#define CELLHEIGHT (45)
#define SECTION_HEIGHT (12.5)

#import "AboutMeViewController.h"
#import "MWFeedBackVC.h"
#import "BaseWebViewController.h"
#import "CommentHelper.h"

@interface AboutMeViewController () <UITableViewDataSource, UITableViewDelegate>

@end

@implementation AboutMeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"关于车挣";
    
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    self.tableView.top = SECTION_HEIGHT;
    self.tableView.scrollEnabled = NO;
    
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


#pragma mark - tableView

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 3;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return CELLHEIGHT;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    static NSString *cellID = @"cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
    }
    
    cell.textLabel.font = FONT_TABLE_TITLE;
    cell.textLabel.textColor = [Theme wordColor];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    [[[UIView viewWithFrame:CGRectMake(0, 0, __MAIN_WIDTH, 0.5)] resetBackgroundColor:[Theme lineColor]] setupOnView:cell.contentView];
    [[[UIView viewWithFrame:CGRectMake(0, CELLHEIGHT, __MAIN_WIDTH, 0.5)] resetBackgroundColor:[Theme lineColor]] setupOnView:cell.contentView];

    [Factory imageViewWithCenter:CGPointMake(__MAIN_WIDTH - 25, CELLHEIGHT/2) image:ImageNamed(@"cell_right") onView:cell.contentView];

    
    switch (indexPath.row) {
        case 0:
            cell.textLabel.text = @"安装说明";
            break;
        case 1:
            cell.textLabel.text = @"给点意见";
            break;
        case 2:
            cell.textLabel.text = @"给个好评吧";
            break;
   
        default:
            break;
    }
    
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    switch (indexPath.row) {
        case 0:
            [self goInstallDeclare];
            break;
        case 1:
            [self gotoFeedBack];
            break;
        case 2:
            [self goStar];
            break;
        default:
            break;
    }
}
- (void)goInstallDeclare
{

    BaseWebViewController * webVC = [[[BaseWebViewController alloc]initWithURL:@"http://m.ichezheng.com/install.html"]navSetupBackItemWithIdentification:BACK_ICON];

    webVC.isScaleBool = NO;
    webVC.title = @"安装说明";
    [self.navigationController pushViewController:webVC animated:YES];

}
- (void)goStar {
    [CommentHelper goAppStore];
}

- (void)gotoFeedBack {
    MWFeedBackVC *vc = [[[MWFeedBackVC alloc] init] navSetupBackItemWithIdentification:BACK_ICON_TITLE];
    [self.navigationController pushViewController:vc animated:YES];
}
@end
